package com.tyl.controller;

import com.tyl.entity.User;
import com.tyl.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/springboot")
public class UserController {
    @Resource
    private UserService userService;
    @GetMapping("/select")
    public List<User> selectAll(){
        List<User> users = userService.selectAll();
        return users;
    }
    @GetMapping("/selectById/{id}")
    public User selectById(@PathVariable("id") Integer id){
        User user = userService.selectById(id);
        return user;
    }
}
